﻿using System;
using System.Net;
using System.Windows;
using System.Windows.Controls;
using System.Windows.Documents;
using System.Windows.Ink;
using System.Windows.Input;
using System.Windows.Media;
using System.Windows.Media.Animation;
using System.Windows.Shapes;

using Microsoft.Phone.Net.NetworkInformation;
using System.Runtime.Serialization.Json;
using System.IO;
using System.Text;

namespace MOTA_WP
{
    public class httpUtil
    {
        public void sendRequest(string Uri, EventCompleteDelegate _EventCompleteDelegate)
        {
            // check the connection
            if (DeviceNetworkInformation.IsNetworkAvailable ||
                DeviceNetworkInformation.IsWiFiEnabled ||
                DeviceNetworkInformation.IsCellularDataRoamingEnabled)
            {

                // create a web client to fetch data;
                WebClient wc = new WebClient();

                // register the downloadStringComplete event
                wc.DownloadStringCompleted += new DownloadStringCompletedEventHandler(_EventCompleteDelegate);

                wc.DownloadStringAsync(new Uri(Uri));
            }
        }

    }
}
